<script type="text/javascript">
$(function(){
	$.post("makeCardBatch/getCardCodeANDCompany",function(data){
		var contentb="<option value='' selected>请选择</option>";
		$(data).each(function(n,item){
			
			for(i=0;i<item.companies.length;i++){
			contentb+="<option value="+item.companies[i].companyNo+">"
			+item.companies[i].companyName+"</option>"
		}
			$("#companiesByP").html(contentb);
		});		
	},"json");
	
}); 

$(function(){
	$.post("inventoryIncmoingMagOfCenter/getFilesInfo",getResponseFilesInfo,"json");
	$("#queryReturnFileInfo").click(function(){
		var batchNo = $("#makeCardNoPC").val();
		console.log("制卡批号===>"+batchNo);
		if(batchNo){
			if(batchNo.length<18 || batchNo.length>18){
				alertMsg.warn("制卡批号的长度为18位！");	
				return false;
			}else if(batchNo.length==18){
				var title = batchNo.substr(0,4);
				var no = batchNo.slice(4);
				var cardCode = batchNo.substr(4,4);
				var year = "20"+batchNo.substr(8,2);
				var month = batchNo.substr(10,2);
				var day = batchNo.substr(12,2);
				console.log("year==>"+year);
				console.log("month==>"+month);
				console.log("day==>"+day);
				var createDate = new Date(year+'/'+month+'/'+day);
				var dateFlag ;
				if(createDate.getFullYear() == year && (createDate.getMonth() + 1) == month && createDate.getDate() == day){
					dateFlag = true;
				}else{
					dateFlag = false;
				}
				if(!/^[A-Za-z]+$/.test(title) || !/^\d{14}\b/.test(no)){
					alertMsg.warn("请输入4位字母和14位数字");	
					return false;
				}else if(dateFlag==false){
					alertMsg.warn("请输入正确的制卡批号");
					return false;
				}
			}
		}
		$("input[name='pageNum']").val("1");
	});
});

function validateCheckBox(obj){
	var $obj = $(obj);
	if($("input[name='responseFiletasked']:checked").length < 1){
		 alertMsg.warn("您未选择数据！")	
		 return false;
	}
}

</script>	
<div class="pageHeader">
	<form id="pagerForm" method="post" action="inventoryIncmoingMagOfCenter/getFilesInfo" class="pageForm required-validate" onsubmit="return validateCallback(this,getResponseFilesInfo);">
		<input type="hidden" name="pageNum" value="" />  
		<input type="hidden" name="numPerPage" value="" />
		<!-- <input type="hidden" name="orderField" value="${param.orderField}" />
		<input type="hidden" name="orderDirection" value="${param.orderDirection}" /> -->
		<div class="searchBar">
			<table class="searchContent">
			<tr>
				<td><label>制卡批号：</label></td>
				<td><input id="makeCardNoPC" name="makeCardNo"  type="text" size="30" /></td>
			</tr>
			<tr>
				<td><label>制卡供应商：</label></td>
				<td style="text-align:left"><select id="companiesByP" name="companies" ></select></td>
			</tr>
			<tr>
				<td><label>柜员编号：</label></td>
				<td><input  name="userNoQC" class="" type="text" size="30"  readonly="readonly" unselectable="on"/></td>
			</tr>
			<tr>
				<td><label>网点编号：</label></td>
				<td><input  name="branchNoQC" class="" type="text" size="30"  readonly="readonly" unselectable="on"/></td>
			</tr>
			</table>
		<div class="subBar">
			<ul> 
				<li>
				<div class="buttonActive" ><div class="buttonContent" ><button id="queryReturnFileInfo" type="submit">查询</button></div></div>
				</li>
			</ul>
		</div>
		</div>
	</form>	
</div>

<form  method="post" action="inventoryIncmoingMagOfCenter/toIncomingReg" class="pageForm required-validate" onsubmit="return validateCallback(this,navTabAjaxDone);" >
		<!-- <input id="bankName" name="bankName" type="hidden" value="">
		<input id="companyName" name="companyName" type="hidden" value=""> -->
		<div class="pageContent">
	 	<div id="ByPurchaseQuery">
		<table class="table" width="660" layoutH="320" >
			<thead>
				<tr>
					<th width="10%"><input type="checkbox" id="ids" name="tasking" group="responseFiletasked" class="checkboxCtrl"></th>
					<th width="10%" >序号</th>
					<th width="40%" >制卡批号</th>
					<th width="40%" >卡供应商</th>
					<!-- <th width="2%" orderField="accountType">卡产品名称</th> -->
					<!-- <th width="2%" orderField="accountType">制作申请日期</th> -->
					<!-- <th width="2%" orderField="accountCert">数量</th> -->
				</tr>
			</thead>
			<tbody id="responseFileDetail">
						
			</tbody>
			
		</table>
		</div>
	 <div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select  class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value},'responseFileDetail',getResponseFilesInfo)">
				<option value="10">10</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
			</select>
			<span id="totalCountByIM" >条，共${totalCount}条</span>
		</div>
		<div callback='getResponseFilesInfo' id="paginationByQueryPurchaseTask" rel="responseFileDetail" class="pagination" targetType="navTab" totalCount="100" numPerPage="10" pageNumShown="1" currentPage="1"></div>
	</div>
	<div class="formBar">
			<ul> 
				<li>
				<div class="buttonActive" ><div class="buttonContent" ><button id="subTask" onclick="return validateCheckBox(this);" type="submit">下一步</button></div></div>
				</li>
				<!-- <li>
				<div class="buttonActive" ><div class="buttonContent" ><button id="subTask" onclick="return validateChechBox();" type="submit">关闭</button></div></div>
				</li> -->
				
			</ul>
		</div>
	</div>
</form>

	

